﻿@using Quester.Models
@using System.Text
@model Quester.Models.XListViewModel

<div>
@if(Model.Title != null)
{
    <h1 class="XListTitle">@Model.Title</h1>
}
<div style="float: right;">
@foreach (ActionBtn captionBtn in Model.CaptionBtns)
{
    //<h1>@captionBtn.CssClass</h1>
    string ID;
    captionBtn.Parametrs.TryGetValue("ID", out ID);
    <a class = "@captionBtn.CssClass" href="@Url.Action(captionBtn.Action)/@ID" >
    @if (captionBtn.Icon != null)
    {
        <img alt="@captionBtn.Icon" src="@Url.Content("~/Content/Imgs/" + captionBtn.Icon)"/>
    }
    @captionBtn.Title
    </a>
}

</div>
    
    <table class="XListContent" width="100%">
        @foreach (Item item in Model.Items)
        {
            <tr>
            <td style="width: 100%;">@item.Value</td>
                
                    @foreach (ActionBtn btn in Model.ItemBtns)
                    {
                        <td style="width: 100%; font-size: 1.1em">
                            <a class = "@btn.CssClass" href="@Url.Action(btn.Action)/@item.ID">
                                @if (btn.Icon != null)
                                {
                                    <img src="@Url.Content("~/Content/Imgs/" + btn.Icon)" style="display:inline;"/>@btn.Title
                                }
                                else
                                {
                                     @btn.Title
                                }
                            </a>
                        </td>
                    }
            </tr>
        }
    </table>
</div>
